#ifndef BUFDBSERVER_H
#define BUFDBSERVER_H

#include <algorithm>
#include <fstream>
#include <iostream>
#include <google/protobuf/message.h>
#include <google/protobuf/descriptor.h>
#include <iterator>
#include <list>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include "../client/bufferDB.h"
#include <libpq-fe.h>
#include <libpq/libpq-fs.h>

using namespace std;

class bufDBServer : public bufferDB
{
	public: bufDBServer(int argc, char* argv[]);
			
	public:
			void getDataTypeAndStore(int);
			void SaveToDatabase(db::Database* msg);
			void RetrieveFromDatabase(void);
			PGconn * con;			
	
	private:
			PGresult *res;
			string tableQuery;
			void addStringDataToTable();
			bool boolData;
			int  int32Data;
			float floatData;
			double doubleData;
			string stringData;
			std::stringstream values;
			std::stringstream colName;
			string tableName;
			string results;
};

#endif
